/**
 * 商品相关接口
 */

import Q from '@/utils/request'

/**
 * 角色列表
 * @param {*} parameter 
 * @returns 
 */
export function fetchRoleList (parameter) {
  return Q({ url: '/admin/role/page', method: 'POST', data: parameter })
}
/**
 * 角色详情
 * @param {*} id 
 * @returns 
 */
export function fetchRoleDetail (id) {
  return Q({ url: `/admin/role/${id}`, method: 'GET' })
}
/**
 * 角色新增/编辑
 * @param {*} parameter 
 * @returns 
 */
export function fetchRoleEditOrAdd (parameter, type) {
  return Q({ url: `/admin/role/${type}`, data: parameter, method: 'POST' })
}
/**
 * 角色删除
 * @param {*} parameter 
 * @returns 
 */
export function fetchRoleDelete (parameter) {
  return Q({ url: '/admin/role/delete', data: parameter, method: 'POST' })
}
/**
 * 启用/批量启用角色
 * @param {*} parameter 
 * @returns 
 */
export function fetchRoleAble (parameter) {
  return Q({ url: '/admin/role/able', data: parameter, method: 'POST' })
}
/**
 * 禁用/批量禁用角色
 * @param {*} parameter 
 * @returns 
 */
export function fetchRoleDisable (parameter) {
  return Q({ url: '/admin/role/disable', data: parameter, method: 'GET' })
}
/**
 * 菜单分页列表
 * @param {*} parameter 
 * @returns 
 */
export function fetchMenuList (parameter) {
  return Q({ url: '/admin/menu/page', data: parameter, method: 'GET' })
}
/**
 * 添加菜单/编辑菜单
 * @param {*} parameter 
 * @returns 
 */
export function fetchMenuAddOrEdit (parameter, type) {
  return Q({ url: `/admin/menu/${type}`, data: parameter, method: 'POST' })
}
/**
 * 删除菜单
 * @param {*} parameter 
 * @returns 
 */
export function fetchMenuDelete (parameter) {
  return Q({ url: '/admin/menu/delete', data: parameter, method: 'GET' })
}
/**
 * 详情菜单
 * @param {*} parameter 
 * @returns 
 */
export function fetchMenuDetail (parameter) {
  return Q({ url: '/admin/menu/detail', data: parameter, method: 'GET' })
}

/**
 * 导出
 * @param {*} url
 * @param {*} data
 * @returns
 */
export function downLoadExec (url, data = {}) {
  return Q({ url, data, method: 'POST' })
}

/**
 * menu
 * @param {*} data
 */
export function fetchSysMenuList (data = {}) {
  return Q({
    url: '/sys/admin/menu/list',
    data
  })
}

/**
 * menu tree
 * @param {*} data
 * @returns
 */
export function fetchSysMenuTree (data = {}) {
  return Q({ url: '/sys/admin/menu/role/menutree', data })
}

/**
 * delete menu by id
 * @param {*} data
 */
export function deleteMenu (data = {}) {
  return Q({
    url: '/sys/admin/menu/delete',
    data
  })
}

/**
 * menu auto complete
 * @param {*} data
 */
export function fetchMenuAutocomplete (data = {}) {
  return Q({
    url: '/sys/admin/menu/autocomplete',
    data
  })
}

/**
 * and or update menu
 * @param {*} data
 * @param {*} type [add,update]
 */
export function addOrUpdateMenu (data = {}, type = 'add') {
  return Q({
    url: `/sys/admin/menu/${type}`,
    data
  })
}

/**
 * fetch menu info
 * @param {*} data
 */
export function fetchMenuInfo (data = {}) {
  return Q({
    url: '/sys/admin/menu/info',
    data
  })
}

/**
 * Role
 * @param {*} data
 */
export function fetchSysRoleList (data = {}) {
  return Q({
    url: '/sys/admin/role/page',
    data
  })
}

/**
 * delete role by id
 * @param {*} data
 */
export function deleteRole (data = {}) {
  return Q({
    url: '/sys/admin/role/delete',
    data
  })
}

/**
 * role auto complete
 * @param {*} data
 */
export function fetchRoleAutocomplete (data = {}) {
  return Q({
    url: '/sys/admin/role/autocomplete',
    data
  })
}

/**
 * and or update role
 * @param {*} data
 * @param {*} type [add,update]
 */
export function addOrUpdateRole (data = {}, type = 'add') {
  return Q({
    url: `/sys/admin/role/${type}`,
    data
  })
}

/**
 * fetch role info
 * @param {*} data
 */
export function fetchRoleInfo (data = {}) {
  return Q({
    url: '/sys/admin/role/info',
    data
  })
}

/**
 * fetch limit menu
 * @param {*} data
 */
export function fetchRoleLimitMenu (data = {}) {
  return Q({
    url: '/sys/admin/menu/limit/list',
    data
  })
}

/**
 * user
 * @param {*} data
 */
export function fetchSysUserList (data = {}) {
  return Q({
    url: '/sys/admin/user/list',
    data
  })
}

/**
 * delete user by id
 * @param {*} data
 */
export function deleteUser (data = {}) {
  return Q({
    url: '/sys/admin/user/delete',
    data
  })
}
/**
 * user auto complete
 * @param {*} data
 */
export function fetchUserAutocomplete (data = {}) {
  return Q({
    url: '/sys/admin/user/autocomplete',
    data
  })
}

/**
 * and or update user
 * @param {*} data
 * @param {*} type [add,update]
 */
export function addOrUpdateUser (data = {}, type = 'add') {
  return Q({
    url: `/sys/admin/user/${type}`,
    data
  })
}

/**
 * fetch user info
 * @param {*} data
 */
export function fetchUserInfo (data = {}) {
  return Q({
    url: '/sys/admin/user/info',
    data
  })
}

/**
 * fetch limit user
 * @param {*} data
 */
export function fetchRoleLimitRole (data = {}) {
  return Q({
    url: '/sys/admin/role/limit/list',
    data
  })
}

// login

export function login (data = {}) {
  return Q({
    url: '/sys/admin/user/login',
    data
  })
}

export function fetchMyMenus (data = {}) {
  return Q({
    url: '/sys/admin/menu/mine',
    data
  })
}

export function fetchLoginInfo (data = {}) {
  return Q({
    url: '/sys/admin/user/mine',
    data
  })
}

export function fetchUserPassword (data = {}) {
  return Q({ url: '/sys/admin/user/password', data })
}

export function resetPassword (data = {}) {
  return Q({ url: '/sys/admin/user/resetPassword', data })
}

/**
 * 用户设置无效
 * @param {*} data
 * @returns
 */
export function userEffective (data = {}) {
  return Q({ url: '/sys/admin/user/effective', data })
}

/**
 * 所属系统
 * @param {*} data
 * @returns
 */
export function fetchSystemSelector (data = {}) {
  return Q({
    url: '/merchant/admin/products/list/open/product',
    data: { type: 'B', ...data }
  })
}

/**
 * 所属系统
 * @param {*} data
 * @returns
 */
export function fetchSystemSelector2 (data = {}) {
  return Q({
    url: '/merchant/admin/products/list/open/product',
    data: data
  })
}

/**
 * 数据权限添加
 * @param {*} data
 * @returns
 */
export function addStaffDataPermission (data = {}) {
  return Q({ url: '/sys/admin/staffs/data/permission/add', data })
}

/**
 * 数据权限修改
 * @param {*} data
 * @returns
 */
export function updateStaffDataPermission (data = {}) {
  return Q({ url: '/sys/admin/staffs/data/permission/update', data })
}
/**
 * 修改企微数据权限
 * @param {*} data
 * @returns
 */
export function addStaffWxDataPermission (data = {}) {
  return Q({ url: '/sys/admin/staffs/wx/data_permission/update', data })
}
/**
 * 企微数据权限获取
 * @param {*} data
 * @returns
 */
export function fetchStaffWxDataPermission (data = {}) {
  return Q({ url: '/sys/admin/staffs/wx/data_permission/limit/list', data })
}
/**
 * 数据权限获取
 * @param {*} data
 * @returns
 */
export function fetchStaffDataPermission (data = {}) {
  return Q({ url: '/sys/admin/staffs/data/permission/limit/list', data })
}

export function fetchRoleAdminList (data = {}) {
  return Q({ url: '/sys/admin/role/limit/list', data })
}
/**
 * 下载中心列表
 * @param {*} data
 */
export function downloadCenterList (data = {}) {
  return Q({ url: '/data/file/page', data })
}
/**
 * 下载
 * @param {*} data
 */
export function download (data = {}) {
  return Q({ url: '/data/file/download?id=5', data })
}

/**
 * 查询物流平台下的所有物流公司
 * @param {*} data
 * @returns
 */
export function fetchLogisticsList (data = {}) {
  return Q({ url: '/merchant/admin/logistics/company/list', data })
}

/**
 * 物流平台 物流参数配置
 * @param {*} data
 * @returns
 */
export function fetchLogisticsAdd (data = {}) {
  return Q({ url: '/merchant/admin/logistics/add', data })
}

/**
 * 物流平台 详情
 * @param {*} data
 * @returns
 */
export function fetchLogisticsInfo (data = {}) {
  return Q({ url: '/merchant/admin/logistics/info', data })
}
/**
 * 解锁账号
 */
export function unlockAccount (data = {}) {
  return Q({ url: '/sys/admin/user/account/unlock', data })
}
/**
 * 已开通的C端产品业务模式查询接口
 */
export function fetchProductsOpen (data = {}) {
  return Q({ url: '/merchant/admin/products/open/business-type/list', data })
}
/**
 * 已开通的C端产品业务模式查询接口
 */
export function fetchProductsOrderOpen (data = {}) {
  return Q({ url: '/merchant/admin/products/open/order-business-type/list', data })
}
/**
 * 获取手机验证码
 */
export function fetchSmsCode (data = {}) {
  return Q({ url: '/sys/admin/user/sms/code', data })
}
/**
 * 手机号登录查询返回多账号
 */
export function fetchSmsLogin (data = {}) {
  return Q({ url: '/sys/admin/user/sms-validation/login', data })
}
/**
 * 手机验证码验证接口
 * @param {*} data
 * @returns
 */
export function fetchValidateCode (data = {}) {
  return Q({ url: '/sys/admin/user/validate-code', data })
}
/**
 * 用户手机号绑定
 * @param {*} data
 * @returns
 */
export function fetchBindingPhone (data = {}) {
  return Q({ url: '/sys/admin/user/binding/phone', data })
}
/**
 * 切换账号查询
 * @param {*} data
 * @returns
 */
export function fetchUserList (data = {}) {
  return Q({ url: '/sys/admin/user/list-users', data })
}
/**
 * 同步企业微信员工信息
 * @param {*} data
 * @returns
 */
export function fetchUsersInfo (data = {}) {
  return Q({ url: '/sys/admin/user/qywx/users/create', data })
}
/**
 * 同步企业微信员工信息
 * @param {*} data
 * @returns
 */
export function fetchDepartmentList (data = {}) {
  return Q({ url: '/sys/admin/department/user/tree', data })
}
/**
 * 添加店铺映射信息
 * @param {*} data
 * @returns
 */
export function addOrUpdateMap (data = {}, type = 'add') {
  return Q({ url: `/merchant/admin/store_mapping/${type}`, data })
}

/**
 * 店铺映射信息分页列表查询
 * @param {*} data
 * @returns
 */
export function fetchStoreMappingList (data = {}) {
  return Q({ url: '/merchant/admin/store_mapping/list', data })
}
/**
 * 店店铺映射导入功能
 * @param {*} data
 * @returns
 */
export function imporAOFile (data = {}) {
  return Q({ url: '/merchant/admin/store_mapping/file/import', data })
}
/**
 * 店店铺映射导入功能
 * @param {*} data
 * @returns
 */
export function fetchStoreMappingInfo (data = {}) {
  return Q({ url: '/merchant/admin/store_mapping/info', data })
}
/**
 * 店铺映射删除
 * @param {*} data
 * @returns
 */
export function deleteMapping (data = {}) {
  return Q({ url: '/merchant/admin/store_mapping/delete', data })
}
/**
 * 用户解锁权限详情
 * @param {*} data
 * @returns
 */
export function unlockAuthority (data = {}) {
  return Q({ url: '/sys/admin/user/info/unlock/authority', data })
}

/**
 * 设置用户解锁权限
 * @param {*} data
 * @returns
 */
export function setUnlockAuthority (data = {}) {
  return Q({ url: '/sys/admin/user/set/unlock/authority', data })
}
/**
 * 设置用户店铺分类
 * @param {*} data
 * @returns
 */
export function setStoreClassifyPermission (data = {}, type = 'add') {
  //   return Q({ url: `/sys/admin/store/classify/data/permission/${type}`, data });
  return Q({ url: `/sys/classify/data/permission/${type}`, data })
}
/**
 * 店铺分类回选
 * @param {*} data
 * @returns
 */
export function fetchClassifyLists (data = {}) {
  //   return Q({ url: `/sys/admin/store/classify/data/permission/limit/list`, data });
  return Q({ url: '/sys/classify/data/permission/limit/list', data })
}
/**
 * 用户权限设置
 * @param {*} data
 * @returns
 */
export function setUserAuthority (data = {}) {
  return Q({ url: '/sys/admin/user/set/authority', data })
}
/**
 * 用户权限设置info
 * @param {*} data
 * @returns
 */
export function fetchUserAuthorityInfo (data = {}) {
  return Q({ url: '/sys/admin/user/info/authority', data })
}
